home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / hypercar / xcmd / xrulesde.sit / Xrules™ Demo / card_14466.txt < prev    next >
Encoding:
Text File  |  1991-06-24  |  3.5 KB  |  95 lines

  1. -- card: 14466 from stack: in
  2. -- bmap block id: 14646
  3. -- flags: 4000
  4. -- background id: 7992
  5. -- name: 3-Assignments
  6.  
  7.  
  8. -- part 1 (field)
  9. -- low flags: 01
  10. -- high flags: 0007
  11. -- rect: left=2 top=24 right=311 bottom=510
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 0
  15. -- font id: 22
  16. -- text size: 10
  17. -- style flags: 0
  18. -- line height: 13
  19. -- part name: 
  20.  
  21.  
  22. -- part 3 (button)
  23. -- low flags: 00
  24. -- high flags: 0000
  25. -- rect: left=256 top=314 right=337 bottom=281
  26. -- title width / last selected line: 0
  27. -- icon id / first selected line: 1013 / 1013
  28. -- text alignment: 1
  29. -- font id: 0
  30. -- text size: 12
  31. -- style flags: 0
  32. -- line height: 16
  33. -- part name: Next
  34. ----- HyperTalk script -----
  35. on mouseUp
  36.   go to next card
  37. end mouseUp
  38.  
  39.  
  40.  
  41. -- part contents for card part 1
  42. ----- text -----
  43.     -- the rule base
  44.     global declarations
  45.     fact declarations
  46.     ASSIGNMENTS
  47.     rules & daemons
  48.  
  49. Facts or globals may be assigned values at initialization by including assignments in the rule base.  If you include assignments, they must follow the global and fact declarations.  Assignments are made as follows:
  50.  
  51.     assignments  :=  { PUT operand INTO target }
  52.  
  53. where "operand" is the value to assign to the target and "target" is the target of the assignment. 
  54.  
  55. Targets may be facts or globals.  If they are facts, they must be preceded by the keyword FACT.  If they are globals they must have been declared in the global section of the rule base.
  56.  
  57. You may declare as many assignments as needed.  The following examples illustrate assignments:
  58.  
  59.   global xyz, abc, -- declare globals that will be used
  60.       global_1, global_2, 
  61.       global_3, global_4, 
  62.       global_5
  63.  
  64.   put def into fact f1         -- put string "def" into fact "f1"
  65.   put "def" into xyz           -- put string "def" into global "xyz"
  66.   put true into fact f2        -- put "TRUE" into fact "f2"
  67.   put 10.5 into fact "pg cnt"  -- put 10.5 into fact "pg cnt"
  68.   put xyz into fact "nu fact"  -- put the value of global "xyz" into
  69.                                --    fact "nu fact"
  70.                                --    ("nu fact" will contain "def")
  71.   put 11 into abc              -- put 11 into global abc
  72.   put "a string" into fact f3  -- put string "a string" into fact f3
  73.   put fact f3 into fact f4     -- put the value of fact "f3" into
  74.                                --    fact "f4"
  75.                                --    ("f4" will contain "a string")
  76.   put ? into fact f5           -- set fact f5 unknown
  77.   put "?" into fact f6         -- set fact f6 unknown
  78.   put * into fact f7           -- set fact f7 to don't care
  79.   put "*" into fact f8         -- set fact f8 to don't care
  80.   put "" into fact f9          -- set fact f9 to "not asserted" (retract
  81.                                --    the fact)
  82.   put "?" into global_1        -- put string "?" into global_1
  83.   put ? into global_2          -- put string "?" into global_2
  84.   put "*" into global_3        -- put string "*" into global_3
  85.   put * into global_4          -- put string "*" into global_4
  86.   put "" into global_5         -- put null string into global_5
  87.  
  88. Assignments in the assignment section are made during initialization of the system.  Initialization occurs when you execute the "initXrules" XCMD.
  89.  
  90. NOTE:  Assignments made within the assignment section of the rule base are       
  91.        static.  They will not cause the system to execute daemons.  Additionally,   
  92.        when forward chaining, the inference engine will not examine rules as a 
  93.        result of these assignments.
  94.  
  95.